package ldkxingzhe.ldkxingzhedemo.tab;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import ldkxingzhe.ldkxingzhedemo.R;


/**
 * Created by ke on 15-8-28.
 */
public class TextViewFragment extends Fragment{

    private String message;

    public static TextViewFragment newInstance(String message){
        TextViewFragment textViewFragment = new TextViewFragment();
        Bundle args = new Bundle();
        args.putString("message",message);
        textViewFragment.setArguments(args);
        return textViewFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle args = getArguments();
        message = args.getString("message");
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_text_view,container,false);
        ((TextView)view.findViewById(R.id.text_view)).setText(message);
        Log.d("TAG","message = " + message);
        return view;
    }
}
